<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>{% block title %}Simple Blog Admin{% endblock %}</title>

    <link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('static', filename='img/favicon-32x32.png') }}">
    <link rel="icon" type="image/png" sizes="96x96" href="{{ url_for('static', filename='img/favicon-96x96.png') }}">
    <link rel="icon" type="image/png" sizes="16x16" href="{{ url_for('static', filename='img/favicon-16x16.png') }}">

    <!-- Bootstrap Core CSS -->
    <link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    <link href="//cdn.bootcss.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/simpleblog.css') }}" rel="stylesheet">


    <!-- Custom CSS -->

    {% block css %}{% endblock %}
    <style> html{display : none ; } </style>
    <script>
    if( self == top ) {
              document.documentElement.style.display = 'block' ;
       } else {
           top.location = self.location ;
       }
    </script>

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
    <!-- Navigation -->
    <nav class="navbar navbar-default">
      <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="{{ url_for('main.index') }}">Simple Blog</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav">
            <li class="_active"><a href="{{ url_for('blog_admin.index') }}">Home <span class="sr-only">(current)</span></a></li>

            {% if g.identity.allow_write %}
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Posts <span class="caret"></span></a>
              <ul class="dropdown-menu" role="menu">
                <li><a href="{{ url_for('blog_admin.posts') }}">All Posts</a></li>
                <li><a href="{{ url_for('blog_admin.new_report') }}">New Post</a></li>
                <li><a href="{{ url_for('blog_admin.drafts') }}">Drafts</a></li>
                <!-- <li class="divider"></li> -->

                <li class="divider"></li>
                <li><a href="#">Tags</a></li>
                <li><a href="#">Category</a></li>
              </ul>
            </li>
            {% endif %}  <!-- g.identity.allow_write -->

            {% if g.identity.allow_edit %}
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Comments <span class="caret"></span></a>
              <ul class="dropdown-menu" role="menu">
                <li><a href="{{ url_for('blog_admin.comments') }}">Pending</a></li>
                <li><a href="{{ url_for('blog_admin.comments_approved') }}">Approved</a></li>
              </ul>
            </li>
            {% endif %}

            {% if g.identity.allow_admin %}
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Users <span class="caret"></span></a>
              <ul class="dropdown-menu" role="menu">
                <li><a href="{{ url_for('useraccounts.users') }}">All Users</a></li>
                <li><a href="{{ url_for('useraccounts.add_user') }}">New User</a></li>
              </ul>
            </li>
            {% endif %}

            {% if g.identity.allow_admin %}
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Super Admin <span class="caret"></span></a>
              <ul class="dropdown-menu" role="menu">
                <li><a href="#">Super Posts</a></li>
                <li><a href="#">Users</a></li>
                <li class="divider"></li>
                <li><a href="{{ url_for('blog_admin.post_statistics') }}">Posts Statistics</a></li>
              </ul>
            </li>
            {% endif %}
          </ul>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav navbar-right">
          {% if current_user.is_authenticated %}
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{{ current_user.username }} <span class="caret"></span></a>
              <ul class="dropdown-menu" role="menu">
                <li><a href="{{ url_for('useraccounts.setting') }}"><span class="glyphicon glyphicon-cog"></span>&nbsp; Settings</a></li>
                <li class="divider"></li>
                <li><a href="{{ url_for('useraccounts.logout') }}"><span class="glyphicon glyphicon-off"></span>&nbsp; Logout</a></li>
              </ul>
            </li>
          {% else %}
            <li><a href="{{ url_for('useraccounts.login') }}">Login</a></li>
            <li><a href="{{ url_for('useraccounts.register')}}">Regster</a></li>
          {% endif %}
          </ul>
        </div>
        </div>
      </div>
    </nav>


    <!-- Page Header -->
    <!-- Set your background image for this header on the line below. -->
    {%block header %}{% endblock %}
    <div class="container">
        {% import "_msg.html" as messages %}
        {{ messages.render_msg() }}
        <!-- Main Content -->
        {%block main %}{% endblock %}
    </div>
    <hr>

    <!-- Footer -->
    <footer>
        <div class="container">
            <div class="row">
                <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                    <ul class="list-inline text-center">
                        <li>
                            <a href="https://creativecommons.org/licenses/" target="_blank">
                                <span class="fa-stack fa-lg">
                                    <i class="fa fa-circle fa-stack-2x"></i>
                                    <i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
                                </span>
                            </a>
                        </li>
                        <li>
                            <a href="#">
                                <span class="fa-stack fa-lg">
                                    <i class="fa fa-circle fa-stack-2x"></i>
                                    <i class="fa fa-facebook fa-stack-1x fa-inverse"></i>
                                </span>
                            </a>
                        </li>
                        <li>
                            <a href="https://github.com/cylmemory/SimpleBlog" target="_blank">
                                <span class="fa-stack fa-lg">
                                    <i class="fa fa-circle fa-stack-2x"></i>
                                    <i class="fa fa-github fa-stack-1x fa-inverse"></i>
                                </span>
                            </a>
                        </li>
                    </ul>
                    <p class="copyright text-muted text-center">Copyright &copy; Simple Blog 2018</p>
                </div>
            </div>
        </div>
    </footer>
    <!-- jQuery -->
    <script src="//cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
    <!-- Bootstrap Core JavaScript -->
    <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="//cdn.bootcss.com/bootbox.js/4.4.0/bootbox.min.js"></script>

    <!-- Custom Theme JavaScript -->
    {% block js %}
    {% endblock %}

</body>
</html>